package se.perhamrin.judo.domain;

public class UjkMember {
	private int memberId;
	private long idrottOnlineId;
	private String name;

	private UjkMember(int memberId, long idrottOnlineId, String name) {
		this.memberId = memberId;
		this.idrottOnlineId = idrottOnlineId;
		this.name = name;
	}

	public static UjkMember create(int memberId, long idrottOnlineId, String name) {
		return new UjkMember(memberId, idrottOnlineId, name);
	}

	public int getUjkMemberId() {
		return memberId;
	}

	public long getIdrottOnlineId() {
		return idrottOnlineId;
	}

	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return "name: " + name + "|id: " + memberId + "|idrottOnlineId: " + idrottOnlineId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (idrottOnlineId ^ (idrottOnlineId >>> 32));
		result = prime * result + memberId;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		UjkMember other = (UjkMember) obj;
		if (idrottOnlineId != other.idrottOnlineId) {
			return false;
		}
		if (memberId != other.memberId) {
			return false;
		}
		if (name == null) {
			if (other.name != null) {
				return false;
			}
		} else if (!name.equals(other.name)) {
			return false;
		}
		return true;
	}

}